import http from "@/utils/http";
import {CLIENT} from '@/common/const';
import {JRFK_PATH,YNGP} from "../script/const";
/**
 * 获取文章列表
 * @param {Object} option
 * @param {Number} option.limit - 请求条数
 * @param {Number} option.articleType - 文章栏目主键id（articleTypeId）
 * @return {Promise} Array
 */
export function queryArticleList(option) {
  const url = `${JRFK_PATH}/client/queryArticleList.htm`;
  const params = {
    // limit: 10,
    ...option,
  };
  return http.get(url,params);
}
/**
 * 获取文章栏目列表
 * @param {Object} option
 * @param {Number} option.productId - 擒龙的传id 驭龙的不传获取全部文章列表
 * @return {Promise} Array
 */
export  function queryArticleStock(option) {
  const url = `${JRFK_PATH}/client/queryArticleStock.htm`;
  const params = {
    ...option,
  };
  return http.get(url,params);
}
/**
 * 用户行为统计
 * @param {Object} option
 * @return {Promise} Array
 */
export  function userClickUpdate(option) {
  const url = `${CLIENT}/client/insertUserBeInfoDate.htm`;
  const data = JSON.stringify(option);
  const params = {
    data: data,
  };
  return http.post(url, params);
}

/**
 * 发布专属投顾
 * @param {Object} option
 * @param {Number} option.productId - 产品ID
 * @param {Number} option.content - 内容
 * @param {String} option.clientCentralToken -token
 * @return {Promise} Array
 */
 export async function addZstg(option) {
  const url = `${BASE_URL}/client/addZstg.htm`;
  const params = {
    content: "",
    ...option
  };
  const res = await http.post( url, params);
  return res.data;
}

/**
 * 股票搜索
 * @param {Object} params
 * @param {Number} params.path
 * @param {Number} params.pageSize - 请求条数
 * @param {String} params.name - 股票名称
 * @return {Promise} Array
 */
 export async function getStockList(params)
 {
   const url = "http://app.yueniucj.com/app/clickSearchContent.htm";
   const send = {
     searchType: 1,
     limit: 10,
     ...params
   };
   const res = await fetch(`${url}?${fn.objToParamStr(send)}`);
   const {
     data
   } = await res.json();
   return data;
 }

 
/**
 * 获取用户专属投顾当天提问次数
 * @param {Object} option
 * @param {Number} option.productId - 产品ID
 * @param {String} option.clientCentralToken -token
 * @return {Promise} Array
 */
export function todayZsInteractionCount(option) {
  const url = `${CLIENT}/client/todayZsInteractionCount.htm`;
  const params = {
    ...option
  };
  return http.post(url, params);

}

/**
 * 专属投顾列表
 * @param {Object} option
 * @param {Number} option.productId - 产品ID
 * @param {Number} option.limit - 请求条数
 * @param {Number} option.sinceId - 起始ID
 * @param {String} option.clientCentralToken -token
 * @return {Promise} Array
 */
 export function zstgList(option) {
  const url = `${CLIENT}/client/zstgList.htm`;
  const params = {
    limit: 10,
    sinceId: "",
    ...option
  };
  const res = http.get( url, params);
  // return res.data;
  return res;
}